﻿using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;
namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 专门用于电缆连接的一个实体类，但是最终保存的还是ec_enginedata_rel表
    /// </summary>
    public class CableConnRel
    {
        /// <summary>
        /// 图纸ID
        /// </summary>
        public string DrawingID { get; set; }
        /// <summary>
        /// 电缆在图纸上的句柄
        /// </summary>
        public string CablePixelID { get; set; }
        /// <summary>
        /// 电气设备在图纸上的句柄
        /// </summary>
        public string TagPixelID { get; set; }
        /// <summary>
        /// 是否为起始端
        /// </summary>
        public bool IsEnd1 { get; set; }

        /// <summary>
        /// 是否要移除该rel关系
        /// </summary>
        public bool NeedRemove { get; set; } = false;
    }

    /// <summary>
    /// 电缆连接关系的一个类
    /// </summary>
    public class CableConnRes {
        /// <summary>
        /// 电缆工程ID
        /// </summary>
        public string CableID { get; set; }
        /// <summary>
        /// End 1
        /// </summary>
        public string End1 { get; set; }
        /// <summary>
        /// End 2
        /// </summary>
        public string End2 { get; set; }

        /// <summary>
        /// End 1
        /// </summary>
        public string End1Tag { get; set; }
        /// <summary>
        /// End 2
        /// </summary>
        public string End2Tag { get; set; }
    }
    /// <summary>
    /// 电缆连接关系的一个类
    /// </summary>
    public class CableWayRes
    {
        /// <summary>
        /// 工程ID
        /// </summary>
        public string EngineDataID { get; set; }
        /// <summary>
        /// 位号名称
        /// </summary>
        public string TagNumber { get; set; }
        /// <summary>
        /// 对象类型名称
        /// </summary>
        public string ObjectTypeName { get; set; }
    }
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-21 15:33
    /// 描 述：工程数据关联表
    /// </summary>
    [SugarTable(TableName = "ec_enginedata_rel")]
    public class ec_enginedata_relEntity
    {
        #region 实体成员
        /// <summary>
        /// 工程数据关联ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string EngineDataRelID { get; set; }
        /// <summary>
        /// 关联类型ID。<see cref="ec_reltypeEntity.RelTypeID"/>
        /// </summary>
        /// <returns></returns>
        public string RelTypeID { get; set; } = "";
        /// <summary>
        /// 关联工程数据1ID。<see cref="ec_enginedataEntity.EngineDataID"/>
        /// </summary>
        /// <returns></returns>
        public string RelEngineData1ID { get; set; } = "";
        /// <summary>
        /// 关联工程数据2ID。<see cref="ec_enginedataEntity.EngineDataID"/>
        /// </summary>
        /// <returns></returns>
        public string RelEngineData2ID { get; set; } = "";

        public int Seq { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.EngineDataRelID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.EngineDataRelID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段
        /// <summary>
        /// 创建人名称
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string CreateUserName { get; set; }
        /// <summary>
        /// 位号1
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string TagNumber1 { get; set; }

        /// <summary>
        /// objecttypename for tag1
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string Type1 { get; set; }
        /// <summary>
        /// 位号2
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string TagNumber2 { get; set; }
        /// <summary>
        /// objecttypename for tag2
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string Type2 { get; set; }
        /// <summary>
        /// 关联类型
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string RelTypeName { get; set; }

        /// <summary>
        /// 方便批量保存时
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<string> End2IDs { get; set; }
        /// <summary>
        /// 遍历过程一访问
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsVisited { get; set; }
        /// <summary>
        /// 遍历过程一访问
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string EngineDataID { get; set; }
        #endregion
    }
}

